//
//  User.swift
//  edu
//
//  Created by karlzhou on 15/10/29.
//  Copyright (c) 2015年 karlzhou. All rights reserved.
//

import Foundation
import ObjectMapper
class User:Mappable{
    var name:String!
    var password:String!
    var token:String!
    init(){
        
    }
    required init?(_ map: Map){
    }
    
    // Mappable
    func mapping(map: Map) {
        
        name <- map["name"]
        password <- map["password"]
           }

    
    
    /**
     class func current() -> User? {
        let userDefaults = NSUserDefaults.standardUserDefaults()
        let jsonString = userDefaults.stringForKey("__current_user")
        if (jsonString != nil && jsonString != "") {
            let user: User? = Mapper<User>().map(jsonString!)
            return user
        }
        return nil
    }
    
     class func current(user: User?) {
        let userDefaults = NSUserDefaults.standardUserDefaults()
        let jsonString = user == nil ? "" : Mapper<User>().toJSONString(user!, prettyPrint: false)
        userDefaults.setValue(jsonString, forKey: "__current_user")
    }
    **/
     class func isLogged() -> Bool {
//        let user: User? = current()
//        if (user != nil) {
//            return true
//        }
        return true;
    }
}